import '../platforms/third_login_platform_interface.dart';

enum LoginType { sms, autoLogin }
// enum LoginPlatform { mobile,flash, wechat,apple}

class LoginArgs {
  LoginType type;

  ///手机号登录
  String? phone;
  String? authCode;
  String? userInfoKey;

  String? userId;
  String? token;
  String? refreshToken;

  String? emUser;
  String? emPwd;

  LoginPlatform? loginPlatform;

  bool enable() {
    return token != null &&
        refreshToken != null &&
        token!.isNotEmpty &&
        refreshToken!.isNotEmpty;
  }

  LoginArgs(
      {required this.type,
      this.phone,
      this.authCode,
      this.userInfoKey,
      this.token,
      this.refreshToken,
      this.loginPlatform,
      this.emUser,
      this.emPwd,
      this.userId});

  @override
  String toString() {
    return 'LoginArgs{type: $type, phone: $phone, authCode: $authCode, userInfoKey: $userInfoKey, token: $token, refreshToken:$refreshToken, userId: $userId}';
  }
}

class LoginException implements Exception {
  int code;
  String? msg;

  LoginException(this.code, this.msg);
}
